Skip to content

chore(aci milestone 3): migrate remaining anomaly detection alerts #93574

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 16, 2025

Conversation

mifu67
Copy link
Contributor

@mifu67 mifu67 commented Jun 13, 2025

Migrate the alerts that didn't get correctly migrated the first run (due to errors with discord actions or the migration stalling).

@mifu67 mifu67 requested a review from ceorourke June 13, 2025 23:18
@mifu67 mifu67 requested review from a team as code owners June 13, 2025 23:18
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Jun 13, 2025
Comment on lines +731 to +737
alert_rules = AlertRule.objects_with_snapshots.filter(
status__in=[
AlertRuleStatus.PENDING.value,
AlertRuleStatus.NOT_ENOUGH_DATA.value,
],
detection_type="dynamic",
).filter(~Exists(AlertRuleDetector.objects.filter(alert_rule_id=OuterRef("id"))))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Main change is here—fetching the anomaly detection alerts that were not migrated.

AlertRuleTriggerActionType.SLACK.value: "Slack",
AlertRuleTriggerActionType.MSTEAMS.value: "Microsoft Teams",
AlertRuleTriggerActionType.OPSGENIE.value: "Opsgenie",
AlertRuleTriggerActionType.DISCORD.value: "Discord",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added this.

Copy link
Contributor

This PR has a migration; here is the generated SQL for src/sentry/workflow_engine/migrations/0070_migrate_remaining_anomaly_detection_alerts.py

for 0070_migrate_remaining_anomaly_detection_alerts in workflow_engine

--
-- Raw Python operation
--
-- THIS OPERATION CANNOT BE WRITTEN AS SQL

Comment on lines +441 to +442
else:
return "Email [removed]"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added this.

Copy link

codecov bot commented Jun 13, 2025

Codecov Report

Attention: Patch coverage is 88.86463% with 51 lines in your changes missing coverage. Please review.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...0070_migrate_remaining_anomaly_detection_alerts.py 84.30% 51 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           master   #93574       +/-   ##
===========================================
+ Coverage   46.30%   88.02%   +41.71%     
===========================================
  Files       10306    10328       +22     
  Lines      594236   595483     +1247     
  Branches    23141    23141               
===========================================
+ Hits       275175   524173   +248998     
+ Misses     318568    70817   -247751     
  Partials      493      493               

@mifu67 mifu67 merged commit 1da6f91 into master Jun 16, 2025
64 checks passed
@mifu67 mifu67 deleted the mifu67/aci/migrate-remaining-anomaly-detection-alerts branch June 16, 2025 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scope: Backend Automatically applied to PRs that change backend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants